<?php
/* @var $this DisplayController */
/* @var $model Comment */
/* @var $form CActiveForm */
?>
<h2><?php echo $post->title;?></h2>

<p><div><?php echo $post->content; ?></div></p>

<h5 class="p0"><b><?php echo Lang::getResource("comments.all.title"); ?></b></h5>
<hr>
<?php 
date_default_timezone_set('Asia/Ho_Chi_Minh'); ?>
<div class="commentsThread">
	<?php foreach($comments as $c){?>
	<div>
		<b class="p0"><?php echo $c->name; ?>  (<?php echo $c->email; ?>) - 
		<?php 
		
		echo Yii::app()->dateFormatter->format('dd/MM/yyyy H:m:s',$c->createdDate);?> 
		</b>
		<div class="p0"><?php echo $c->content; ?></div>
	</div>
	<hr>
	<?php }?>
</div>

<br>
<h5 class="p0"><b><?php echo Lang::getResource("comments.title"); ?></b></h5>
<hr>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'comment-form',
	'enableClientValidation'=>true,
	'clientOptions'=>array(
		'validateOnSubmit'=>true,
	),
	'action'=>CHtml::normalizeUrl(CController::createUrl('items/display/postComment')),
	
)); ?>
	<?php echo $form->hiddenField($model,'postId',array('value'=>$post->id)); ?>
	<p class="note"><span class="required">*</span> -  
		<?php echo Lang::getResource("contact.require"); ?>.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'name'); ?>
		<?php echo $form->textField($model,'name'); ?>
		<?php echo $form->error($model,'name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'email'); ?>
		<?php echo $form->textField($model,'email'); ?>
		<?php echo $form->error($model,'email'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'content'); ?>
		<?php echo $form->textArea($model,'content',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'content'); ?>
	</div>
	
	
	<div style="clear: both;"></div>
	<?php if(CCaptcha::checkRequirements()): ?>
	<div class="row">
		<?php echo $form->labelEx($model,'verifyCode'); ?>
		<div>
		<?php $this->widget('CCaptcha',array(
    			'buttonLabel' => "Lấy mã khác: ",
    			'showRefreshButton' => true,
    			'clickableImage' => true
			)); ?>
		<?php echo $form->textField($model,'verifyCode'); ?>
		</div>
		<div class="hint">Nhập những ký tự trong hình bên.
		<br/>Không phân biệt chữ hoa chữ thường.</div>
		<?php echo $form->error($model,'verifyCode'); ?>
	</div>
	<?php endif; ?>

	<div class="buttons-wrapper">
		<?php echo CHtml::submitButton(Lang::getResource("send"), array("class"=>"button-1")); ?>
		<?php echo CHtml::resetButton(Lang::getResource("clear"), array("class"=>"button-1")); ?>
	</div>

<?php $this->endWidget(); ?>
</div>



<p>



<?php $this->widget('zii.widgets.CListView', array(
	'dataProvider'=>$dataProvider,
	'itemView'=>'_viewPost',
	'itemsCssClass'=>'postview',
	'itemsTagName'=>'div'
)); ?>

</p>